﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SacNetUg.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SacNetUG.Models.Sponsor>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Sponsors
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">
    var banners;
    var bannerCount = 0;
    $(document).ready(function () {
        $.getJSON("sponsor/GetBannerList", null, function (json) { startBannerRotation(json) });

    });

    $(document).ready(function () {
        $(".adminLink").click(function (event) {
            event.preventDefault();
            $(".adminView").show();
        });

        $(".deleteLink").click(function () {
            $.post(this.href);
            $(this).parent().parent().remove();
            return false;
        });
    });


    function startBannerRotation(bannerList) {
        banners = bannerList;
        setInterval("rotateBanner()", 15000);
    }

    function rotateBanner() {
        bannerCount++;
        if (bannerCount == banners.length) {
            bannerCount = 0;
        }
        $("#bannerImage").attr("src", banners[bannerCount].BannerUrl);
        $("#bannerImage").attr("alt", banners[bannerCount].Name);
        $("#bannerLink").attr("href", banners[bannerCount].Url);

    }

</script>

    <script type="text/javascript" language=javascript>

    </script>

    <h2 id="testId">Sponsors</h2>
    <p>
    Thanks to the following organizations for joining SacDotNet on its commitment.to DotNet technology in the Sacramento region. 
    Banners and links below are for companies who helped us during the last 12 months.
    </p>
    <a id="bannerLink" href="http://www.ineta.org">
        <img class="centered sponsor" id="bannerImage" src="http://www.sacnetug.org/Images/ineta.gif" alt="alt" />
    </a>

    <%--TODO: Loop based on actual rows in sponsorcategory here--%>

    <%ViewData.Add("sponsorCategory", 1); %>
    <% Html.RenderPartial("SponsorGroup",Model); %>

    <% ViewData["sponsorCategory"] = 2; %>
    <% Html.RenderPartial("SponsorGroup",Model); %>

    <% ViewData["sponsorCategory"] = 3; %>
    <% Html.RenderPartial("SponsorGroup",Model); %>

    <% ViewData["sponsorCategory"] = 4; %>
    <% Html.RenderPartial("SponsorGroup",Model); %>

<%--    <% ViewData["sponsorCategory"] = 5; %>
    <% Html.RenderPartial("SponsorGroup",Model); %>--%>

    <% if ((Boolean)ViewData["RenderAdminLink"]) %>
    <% { %>
        <p>
            <a href="" class="adminLink">Admin view</a>
            <br />
            <%=Html.ActionLink("Create", "Create", "Sponsor", null, new {@class = "adminView"})%>
        </p>
    <% } %>



</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
th
{
	text-align:left;
}
</style>

<%--    <script src="../../Scripts/jquery.timer.js" type="text/javascript"></script>--%>
</asp:Content>

